package com.bric.service;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import javax.swing.border.EmptyBorder;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bric.dao.OperationDao;
import com.bric.pojo.OperationNote;
@Service
public class DataAccessService {
	@PersistenceContext
	EntityManager entityManager;
	@Autowired
	OperationDao operationDao;
	public Long compareVersion(Long operationId) {
		Query q=entityManager.createQuery("from OperationNote");
		/*if(null!=operationId){
			q.setParameter(0, operationId);
		}*/
		List<OperationNote> notes=q.getResultList();
		if(!notes.isEmpty()){
			return notes.get(0).getId();
		}
		operationDao.findAll();
		return null;
		
	}
	
}
